﻿using Microsoft.AspNetCore.Mvc;
using Single.Core.Service;
using Single.WebApp.Components;

namespace Single.WebApp.Areas.Sys.Controllers
{
    [Area("sys")]
    public class LogController : WorkController
    {
        public IActionResult Entities()
        {
            return View();
        }

        public string EntitiesData(int pageNum, int pageSize, DateTime start, DateTime end, string type, string status, string user, string message, string data)
        {
            var rows = ServiceSysProps.SysLog.EntityGetPageList(pageNum, pageSize, start, end, type, status, user, message, data, out int total);

            return ServiceResult.SerializeData(new { rows, total });
        }

        public IActionResult Requests()
        {
            return View();
        }

        public string RequestsData(int pageNum, int pageSize, DateTime start, DateTime end, string method, string url, string ip, string browser, string contentType, string body, string user)
        {
            var rows = ServiceSysProps.SysLog.RequestGetPageList(pageNum, pageSize, start, end, method, url, ip, browser, contentType, body, user, out int total);

            return ServiceResult.SerializeData(new { rows, total });
        }
    }
}